/*
 *  msnslp.h - MSNSLP
 *  Copyright (c) 2005 Derek Ingrouville (dergro@users.sourceforge.net)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef _MSNSLP_H
#define _MSNSLP_H

#include "message.h"

#define SLP_NO_HEADER         0x0
#define SLP_OUT_OF_ORDER      0x1
#define SLP_ACK               0x2
#define SLP_INVITE_PENDING    0x4
#define SLP_BINARY_ERROR      0x8
#define SLP_DISP_EMOT_DATA    0x20
#define SLP_FILE_TRANS_DATA   0x01000030

typedef enum _MsnSLPMethod
{
	MSN_SLP_INVITE = 0,
	MSN_SLP_BYE,
	MSN_SLP_UNKNOWN
} MsnSLPMethod;

typedef enum _MsnSLPType
{
	MSN_SLP_SESSION = 0,
	MSN_SLP_TRANSFER
} MsnSLPType;

typedef enum _MsnSLPVersion
{
	MSN_SLP_VERSION_1 = 0,
	MSN_SLP_VERSION_OTHER
} MsnSLPVersion;

typedef enum _MsnSLPContentType
{
	MSN_SLP_CONTENT_SESSIONREQ = 0,
	MSN_SLP_CONTENT_TRANSREQ,
	MSN_SLP_CONTENT_TRANSRESP,
	MSN_SLP_CONTENT_UNKNOWN
} MsnSLPContentType;

typedef struct _MsnSLPHeader
{
	long session_id;    /* Field 1, Session ID */
	long baseid;	    /* Field 2, Base Identifier */
	long long offset;   /* Field 3, Offset used if data send > 1202 bytes */
	long long datasize;	/* Field 4, Total size of data being sent*/
	long curmsgsize;	/* Field 5, Size of data being sent in this message */
	long flag;		    /* Field 6, Identifies the message type */
	long acknowledged;  
	long ack_unique_id; 
	long long ack_size;
} MsnSLPHeader;

typedef struct _MsnSLPMsg
{
	MsnSLPMethod  method;       /* Method being used    */
	MsnSLPVersion version;	    /* Protocol Version     */
	MsnSLPHeader *header;        /* Binary Header        */
	char *to;		            /* Recipient's Passport */
	char *from;				    /* Senders Passport     */
	char *via;				    /* version and GUID     */
	int cseq;				    /* Command Sequence     */
	char *callid;			    /* Session GUID         */
	int maxforwards;		    /* Currently unused     */
	MsnSLPContentType content;	/* Content Type         */
	int content_len;		    /* Length of msg body   */
	int bin_footer;			    /* Binary Footer        */
	MsnMessage *slpmsg;         /* Full message         */

} MsnSLPMsg;

MsnSLPMsg *msn_slpmsg_new ();
MsnSLPMsg *msn_slpmsg_new_from_msg (MsnMessage *msg);
/* TODO: possible build slp msg function */
void msn_slpmsg_free (MsnSLPMsg *slpmsg);

MsnSLPMsg *msn_slpmsg_invite_new ();

#endif /* _MSNSLP_H */

